package org.bakerstreet.components.render;

import org.bakerstreet.components.Component;

public class LabelRender extends ComponentRender {

	@Override
	public void render(Component comp, StringBuffer sb) {
		String containerId = "$"+comp.getRow()+"$"+comp.getColumn();
		sb.append("comp"+comp.getId()+" = new Label(\""+comp.getId()+"\",\""+containerId+"\");");
		sb.append("comp"+comp.getId()+".render();");
		sb.append("comp"+comp.getId()+".setValue(\""+comp.getValue()+"\");");
	}

	@Override
	public void update(Component comp, StringBuffer sb) {
		String jsComponent = "comp"+comp.getId(); 
		sb.append(jsComponent).append("setValue(\"").append(comp.getValue()).append("\");");
	}

}
